<?php

declare(strict_types=1);

use Hyperf\HttpServer\Router\Router;

// 网关信息
Router::addRoute(['GET', 'POST', 'HEAD'], '/', 'App\Controller\GatewayController@index');
Router::get('/gateway', 'App\Controller\GatewayController@index');
Router::get('/gateway/health', 'App\Controller\GatewayController@health');

// 服务代理路由
Router::get('/gateway/api/notice/{path:.*}', 'App\Controller\GatewayController@proxyToNotice');
Router::get('/gateway/api/data/{path:.*}', 'App\Controller\GatewayController@proxyToData');

// RPC 路由
Router::post('/gateway/api/rpc/notice/{path:.*}', 'App\Controller\GatewayController@rpcToNotice');
Router::post('/gateway/api/rpc/data/{path:.*}', 'App\Controller\GatewayController@rpcToData');

// API 路由 - 测试各个服务
Router::get('/gateway/api/notice/test-rpc', 'App\Controller\GatewayController@testNoticeRpc');
Router::get('/gateway/api/notice/test-db', 'App\Controller\GatewayController@testNoticeDb');
Router::get('/gateway/api/notice/test-redis', 'App\Controller\GatewayController@testNoticeRedis');
Router::post('/gateway/api/data/rpc', 'App\Controller\GatewayController@testDataRpc');